/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2021-11-28     xuan       the first version
 */
#include<rtthread.h>
#include<rtdevice.h>
#include<time.h>

int rtc_sample(void){
    rt_err_t ret=RT_EOK;
    time_t now ;
    ret=set_date(2020, 11, 02);
    if (ret!=RT_EOK) {
        rt_kprintf("set RTC date failed\n");
        return ret;
    }
    ret=set_time(11, 15, 50);
    if(ret!=RT_EOK){
        rt_kprintf("set RTC time failed\n");
        return ret;
    }

    rt_thread_mdelay(3000);
    now=time(RT_NULL);
    rt_kprintf("%s\n",ctime(&now));
    return ret;
}

INIT_APP_EXPORT(rtc_sample);
